<%@ page
	language="java"
	contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
%>
<%@ taglib 
	prefix="c" 
	uri="http://java.sun.com/jsp/jstl/core"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
<!--
	function goCommon(type) {
				
		if ("oauth" == type) {
			document.loginform.action = "<%=request.getContextPath() %>/oauth";			
			document.loginform.submit();
		} else if ("logout" == type) {
			document.loginform.action = "<%=request.getContextPath() %>/main";
			document.loginform.method = "post";
			document.loginform.mode.value = type;
			document.loginform.submit();
		} else if ("tweet" == type) {
			document.tweetform.action = "<%=request.getContextPath() %>/main";
			document.tweetform.method = "post";
			document.tweetform.mode.value = type;
			document.tweetform.submit();
		}
	}	
//-->
</script>
</head>
<body>

<form name="loginform" id="loginform">
<input type="hidden" name="mode" />
<c:if test="${empty accessToken }">
<input type="text" name="user_id" />
<input type="password" name="user_pwd" />
<input type="button" name="oauth" value="로그인" onclick="goCommon('oauth');" />
</c:if>

<c:if test="${!empty accessToken }">
<a href="http://twitter.com/${scName }" target="_blank">@${scName }</a> 님 환영합니다.
<input type="button" name="logout" value="로그아웃" onclick="goCommon('logout');" />
</c:if>
<!--<a href="#twitLogin" onClick="twitLogin();">트위터 로그인</a>
-->
</form>

<form name="tweetform">
<input type="hidden" name="mode" />
<textarea name="tweet" rows="4" cols="90" style="overflow:hidden"></textarea>
<input type="button" value="입력" onclick="goCommon('tweet')" />
</form>

</body>
</html>